FROM registry-jinan-lab.inspurcloud.cn/library/os/inspur-ubuntu-18.04:5.2.0
RUN mkdir -p /usr/bin/fcs-api/
RUN mkdir -p /etc/config/
RUN mkdir -p /init
ADD runtime/fcs-runtimes/examples-code /usr/bin/fcs-api/
ADD main /usr/bin/fcs-api/main
ADD init /init
ADD metricConfig.yaml /usr/bin/fcs-api/metricConfig.yaml
ADD src/app/log4go.xml /usr/bin/fcs-api/log4go.xml
ADD src/db /db
RUN chmod -R a+rwx /usr/bin/fcs-api/main
RUN mkdir -p /var/log/fcs
RUN echo 'init xorm log' >> /var/log/fcs/xorm.log
ADD codefile /usr/bin/fcs-api/codefile
ADD src/app/i18n /usr/bin/fcs-api/i18n
RUN apt-get update && apt-get install -y \
    wget=1.19.4-1ubuntu2.2 \
    net-tools=1.60+git20161116.90da8a0-1ubuntu1

# 创建非root用户并设置权限
RUN useradd -m -u 10001 fcsuser && \
    chown -R fcsuser:fcsuser /usr/bin/fcs-api && \
    chown -R fcsuser:fcsuser /var/log/fcs

# 指定非root用户执行
USER fcsuser


ENTRYPOINT ["/usr/bin/fcs-api/main"]
CMD ["--fcs-config-file=/etc/config/fcs-app.conf"]


